<html>
<head><meta charset="utf-8"><title>How can I run clippy tests from rust-lang/rust? · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html">How can I run clippy tests from rust-lang/rust?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233835765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233835765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233835765">(Apr 09 2021 at 14:59)</a>:</h4>
<p>Right now I get a sysroot error:</p>
<div class="codehilite"><pre><span></span><code>$ x.py test src/tools/clippy
...
     Running tests/compile-test.rs (build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-bf9fb39e2a518294)

running 1 test
test compile_test ... FAILED

failures:

---- compile_test stdout ----
thread &#39;compile_test&#39; panicked at &#39;Found multiple rlibs for crate `serde`: `&quot;/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-3ca40ec15cdb044c.rlib&quot;` and `&quot;/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a25623394d0142d8.rlib&quot;&#39;, src/tools/clippy/tests/compile-test.rs:51:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
</code></pre></div>



<a name="233836391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233836391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233836391">(Apr 09 2021 at 15:01)</a>:</h4>
<p>I usually fix this by doing <code>rm blah/deps/lib&lt;name&gt;-*</code> and try again</p>



<a name="233836776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233836776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233836776">(Apr 09 2021 at 15:02)</a>:</h4>
<p>hmm, well <code>--stage 2</code> worked ok so I'm going with that for now</p>



<a name="233837467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233837467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233837467">(Apr 09 2021 at 15:04)</a>:</h4>
<p>oh yay more fun <a href="https://github.com/rust-lang/rust/issues/84036">https://github.com/rust-lang/rust/issues/84036</a></p>



<a name="233838821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233838821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233838821">(Apr 09 2021 at 15:09)</a>:</h4>
<p>hmm, <code>cargo dev bless</code> didn't do anything</p>



<a name="233838870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233838870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233838870">(Apr 09 2021 at 15:09)</a>:</h4>
<p>(I can tell because there are still merge conflict markers in the stdout file)</p>



<a name="233839562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233839562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233839562">(Apr 09 2021 at 15:12)</a>:</h4>
<p>ok well I can just copy paste the diff for now</p>



<a name="233850360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/233850360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#233850360">(Apr 09 2021 at 16:15)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/84039">https://github.com/rust-lang/rust/pull/84039</a></p>



<a name="234519726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234519726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234519726">(Apr 14 2021 at 15:23)</a>:</h4>
<p>who wrote cargo dev originally? Does anyone know why it would just silently do nothing?</p>



<a name="234520345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234520345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234520345">(Apr 14 2021 at 15:27)</a>:</h4>
<p>ok well there's the issue, this println fires for every test</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="c1">// If compiletest did not write any changes during the test run,</span>
<span class="w">    </span><span class="c1">// we don't have to update anything</span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="o">!</span><span class="n">test_output_path</span><span class="p">.</span><span class="n">exists</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="fm">println!</span><span class="p">(</span><span class="s">"ignoring {}"</span><span class="p">,</span><span class="w"> </span><span class="n">test_output_path</span><span class="p">.</span><span class="n">display</span><span class="p">());</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="234520535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234520535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234520535">(Apr 14 2021 at 15:28)</a>:</h4>
<p>I think the issue is it's hardcoding the target dir as <code>src/tools/clippy/target</code>, which doesn't exist</p>



<a name="234520824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234520824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234520824">(Apr 14 2021 at 15:30)</a>:</h4>
<p>do I need to run <code>cargo test</code> before <code>cargo dev bless</code>? I don't see where it's generating the .stderr files</p>



<a name="234521601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234521601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234521601">(Apr 14 2021 at 15:34)</a>:</h4>
<p>also <code>cargo test</code> doesn't work from rust-lang/rust because <code>CARGO_TARGET_DIR</code> doesn't take into account workspaces :/ <span class="user-mention" data-user-id="264664">@flip1995</span> how do you feel about changing that to use <code>cargo metadata | jq .target_directory</code> instead? (or the rust equivalent)</p>



<a name="234521712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234521712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234521712">(Apr 14 2021 at 15:34)</a>:</h4>
<p>I guess if <code>x.py test src/tools/clippy</code> works it doesn't <em>really</em> matter</p>



<a name="234522471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234522471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234522471">(Apr 14 2021 at 15:39)</a>:</h4>
<p>ok it looks like the <em>proper</em> target dir for this is <code>build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-dae41d27c5bce67b/out/test_build_base/zero_ptr.err</code></p>



<a name="234522492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234522492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234522492">(Apr 14 2021 at 15:39)</a>:</h4>
<p>let me try rerunning cargo dev bless with that set</p>



<a name="234522844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234522844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234522844">(Apr 14 2021 at 15:42)</a>:</h4>
<p>it looks like there's no way to run <code>cargo dev bless</code> in release mode? <span aria-label="confused" class="emoji emoji-1f615" role="img" title="confused">:confused:</span></p>



<a name="234523145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234523145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234523145">(Apr 14 2021 at 15:43)</a>:</h4>
<p>oh and even with PROFILE=release it doesn't work :/ I don't know how <code>build/clippy-dae41d27c5bce67b/out</code> ends up in there</p>



<a name="234523327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234523327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234523327">(Apr 14 2021 at 15:44)</a>:</h4>
<p>you're killing me here</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="n">config</span><span class="p">.</span><span class="n">build_base</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">cargo</span>::<span class="n">is_rustc_test_suite</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="c1">// This make the stderr files go to clippy OUT_DIR on rustc repo build dir</span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">PathBuf</span>::<span class="n">from</span><span class="p">(</span><span class="fm">env!</span><span class="p">(</span><span class="s">"OUT_DIR"</span><span class="p">));</span><span class="w"></span>
<span class="w">        </span><span class="n">path</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="s">"test_build_base"</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="n">path</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">host_lib</span><span class="p">().</span><span class="n">join</span><span class="p">(</span><span class="s">"test_build_base"</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
</code></pre></div>



<a name="234524661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234524661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234524661">(Apr 14 2021 at 15:52)</a>:</h4>
<p>ok yay now this at least does <em>something</em><br>
<code>PROFILE=release CARGO_TARGET_DIR=$(git rev-parse --show-toplevel)/build/x86_64-unknown-linux-gnu/stage2-tools cargo dev bless</code></p>



<a name="234524810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234524810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234524810">(Apr 14 2021 at 15:53)</a>:</h4>
<p>except that it's also changing files I didn't intentionally break? was there a recent change like this?</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/src/tools/clippy/tests/ui/or_fun_call.stderr b/src/tools/clippy/tests/ui/or_fun_call.stderr</span>
<span class="gh">index 9905029ce91..40708f8f12e 100644</span>
<span class="gd">--- a/src/tools/clippy/tests/ui/or_fun_call.stderr</span>
<span class="gi">+++ b/src/tools/clippy/tests/ui/or_fun_call.stderr</span>
<span class="gu">@@ -70,7 +70,7 @@ error: use of `or_insert` followed by a function call</span>
   --&gt; $DIR/or_fun_call.rs:66:23
    |
 LL |     map_vec.entry(42).or_insert(vec![]);
<span class="gd">-   |                       ^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(Vec::new)`</span>
<span class="gi">+   |                       ^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(..)`</span>

 error: use of `or_insert` followed by a function call
   --&gt; $DIR/or_fun_call.rs:69:21
<span class="gu">@@ -82,7 +82,7 @@ error: use of `or_insert` followed by a function call</span>
   --&gt; $DIR/or_fun_call.rs:72:25
    |
 LL |     btree_vec.entry(42).or_insert(vec![]);
<span class="gd">-   |                         ^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(Vec::new)`</span>
<span class="gi">+   |                         ^^^^^^^^^^^^^^^^^ help: try this: `or_insert_with(..)`</span>

 error: use of `unwrap_or` followed by a function call
   --&gt; $DIR/or_fun_call.rs:75:21
</code></pre></div>



<a name="234526405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234526405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234526405">(Apr 14 2021 at 16:02)</a>:</h4>
<p>how does <code>cargo dev</code> work? how does cargo know to run <code>clippy_dev/target/debug/clippy_dev</code>?</p>



<a name="234526637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234526637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234526637">(Apr 14 2021 at 16:03)</a>:</h4>
<p>it only seems to work from src/tools/clippy</p>



<a name="234528792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234528792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234528792">(Apr 14 2021 at 16:16)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust-clippy/blob/b1c675f3fc682201cdb28719133285b878e2d157/.cargo/config#L3">https://github.com/rust-lang/rust-clippy/blob/b1c675f3fc682201cdb28719133285b878e2d157/.cargo/config#L3</a></p>



<a name="234529134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234529134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234529134">(Apr 14 2021 at 16:18)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F/near/234521712">said</a>:</p>
<blockquote>
<p>I guess if <code>x.py test src/tools/clippy</code> works it doesn't <em>really</em> matter</p>
</blockquote>
<p>That does work. This is what is run on CI and what I run to test Clippy in Rust locally on every sync.</p>
<p><code>cargo dev</code> was never designed to work from <code>rust-lang/rust</code>, so it doesn't know anything about the Rust build system. Everything that is in there concerning the Rust build system is just patch work. We want to make it work in <code>rust-lang/rust</code>, but  no one has completed work on this. <a href="https://github.com/rust-lang/rust-clippy/issues/5394">rust-lang/rust-clippy#5394</a> See the comments <a href="https://github.com/rust-lang/rust-clippy/issues/5394#issuecomment-767694586">starting from here</a> on this issue.</p>
<p>cc <span class="user-mention" data-user-id="197894">@Phil H</span> <span class="user-mention" data-user-id="369415">@xFrednet</span> IIUC getting proper <code>cargo dev bless</code> support in <code>rust-lang/rust</code> is kinda blocked on Clippy using the same compiletest as <code>rustc</code>?</p>
<blockquote>
<p>how does cargo dev work? how does cargo know to run clippy_dev/target/debug/clippy_dev?</p>
</blockquote>
<p>As <span class="user-mention" data-user-id="374396">@hyd-dev</span> pointed out with a <code>cargo</code> alias</p>



<a name="234529501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234529501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234529501">(Apr 14 2021 at 16:20)</a>:</h4>
<blockquote>
<p>cc @_Phil H @_xFrednet IIUC getting proper cargo dev bless support in rust-lang/rust is kinda blocked on Clippy using the same compiletest as rustc?</p>
</blockquote>
<p>I have a half-working prototype</p>



<a name="234529627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234529627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234529627">(Apr 14 2021 at 16:21)</a>:</h4>
<p>compiletest is not the hard part, I just had to patch it not to special-case rustc</p>



<a name="234529712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234529712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234529712">(Apr 14 2021 at 16:21)</a>:</h4>
<p>current status:</p>
<div class="codehilite"><pre><span></span><code>failures:
    compile_test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.22s

error: test failed, to rerun pass &#39;--test compile-test&#39;


command did not execute successfully: &quot;/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage0/bin/cargo&quot; &quot;test&quot; &quot;--target&quot; &quot;x86_64-unknown-linux-gnu&quot; &quot;-Zbinary-dep-depinfo&quot; &quot;-j&quot; &quot;8&quot; &quot;--release&quot; &quot;--manifest-path&quot; &quot;/home/joshua/rustc/src/tools/clippy/Cargo.toml&quot; &quot;--&quot;
expected success, got: exit code: 101


   Compiling libc v0.2.93
   Compiling same-file v1.0.6
   Compiling strsim v0.8.0
   Compiling ansi_term v0.11.0
   Compiling vec_map v0.8.2
   Compiling opener v0.4.1
   Compiling shell-escape v0.1.5
   Compiling bytecount v0.6.2
   Compiling textwrap v0.11.0
   Compiling walkdir v2.3.1
   Compiling atty v0.2.14
   Compiling clap v2.33.3
   Compiling clippy_dev v0.0.1 (/home/joshua/rustc/src/tools/clippy/clippy_dev)
warning: hidden lifetime parameters in types are deprecated
  --&gt; src/tools/clippy/clippy_dev/src/new_lint.rs:47:23
   |
47 | fn create_lint(lint: &amp;LintData) -&gt; io::Result&lt;()&gt; {
   |                       ^^^^^^^^- help: indicate the anonymous lifetime: `&lt;&#39;_&gt;`
   |
   = note: `-W elided-lifetimes-in-paths` implied by `-W rust-2018-idioms`

warning: hidden lifetime parameters in types are deprecated
  --&gt; src/tools/clippy/clippy_dev/src/new_lint.rs:71:23
   |
71 | fn create_test(lint: &amp;LintData) -&gt; io::Result&lt;()&gt; {
   |                       ^^^^^^^^- help: indicate the anonymous lifetime: `&lt;&#39;_&gt;`

warning: 2 warnings emitted

    Finished release [optimized + debuginfo] target(s) in 11.00s
     Running `build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy_dev bless`
thread &#39;main&#39; panicked at &#39;error: Can&#39;t determine root of project. Please run inside a Clippy working dir.&#39;, src/tools/clippy/clippy_dev/src/lib.rs:360:5
stack backtrace:
</code></pre></div>



<a name="234529885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234529885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234529885">(Apr 14 2021 at 16:23)</a>:</h4>
<p>Wait what? <code>clippy_dev</code> shouldn't be compiled in <code>rust-lang/rust</code></p>



<a name="234529949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234529949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234529949">(Apr 14 2021 at 16:23)</a>:</h4>
<p>well clippy's compiletest doesn't seem very close to unifying with rustc's :/ and this is close to working</p>



<a name="234530466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234530466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234530466">(Apr 14 2021 at 16:27)</a>:</h4>
<p>ok yes it's working :)</p>



<a name="234531027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234531027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234531027">(Apr 14 2021 at 16:31)</a>:</h4>
<p><span class="user-mention" data-user-id="264664">@flip1995</span> do you recognize this change it made? <a href="#narrow/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F/near/234524810">https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F/near/234524810</a></p>



<a name="234538784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234538784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234538784">(Apr 14 2021 at 17:18)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/84189">https://github.com/rust-lang/rust/pull/84189</a></p>



<a name="234542525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234542525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234542525">(Apr 14 2021 at 17:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F/near/234531027">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> do you recognize this change it made? </p>
</blockquote>
<p>Nope. No idea what's going on there. Maybe stale reference files in the build dir? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="234542778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234542778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234542778">(Apr 14 2021 at 17:42)</a>:</h4>
<p>hmm, I tried deleting it but now the test itself fails</p>



<a name="234542803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234542803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234542803">(Apr 14 2021 at 17:42)</a>:</h4>
<p>anyway I don't have time to look at it now, I'll look again this afternoon</p>



<a name="234543240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/How%20can%20I%20run%20clippy%20tests%20from%20rust-lang/rust%3F/near/234543240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/How.20can.20I.20run.20clippy.20tests.20from.20rust-lang.2Frust.3F.html#234543240">(Apr 14 2021 at 17:44)</a>:</h4>
<p>Hm clippy tests in the PR CI passed in <a href="https://github.com/rust-lang/rust/issues/84189">#84189</a>. without touching those test files in the PR.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>